﻿using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Runtime.Serialization;
using System.Security.Permissions;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace SerializeProject
{
    
    [Serializable]
    public class Beverage
    {
        public string Name { get; set; }
        public double Price { get; set; }
        public bool IsAlcoholic { get; set; }
        public Rate Rate{ get; set; }
        public double SpecialOffer;
        public Dummy Dummy { get; set; }
        public Beverage()
        {
            //Parameterless constructor
        }
        public override string ToString()
        {
            string format;
            if (this.Dummy == null)
            {
                format = "Name: {0}, Price: {1}, IsAlcoholic: {2}" +
                         " Rate: {3}";

            }
            else
	        {
                format = "Name: {0}, Price: {1}, IsAlcoholic: {2}" +
                         " Rate: {3}\n, Dummy.prop1: {4}, Dummy.prop2: {5}"; 
	        }

            return (this.Dummy == null) ? string.Format(format, this.Name,
                this.Price,
                this.IsAlcoholic,
                this.Rate) : string.Format(format, this.Name,
                this.Price,
                this.IsAlcoholic,
                this.Rate,this.Dummy.prop1,
                this.Dummy.prop2);
        }
    }

    [Serializable]
    public class Dummy
    {
        public string prop1 { get; set; }
        public int prop2 { get; set; }
       
    }
    public enum Rate
    {  
        Bad,
        Medium,
        Good,
        Excellent,
        Tereffic
    }
}
